package org.bonorsoft.modules.control.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.bonorsoft.modules.control.entity.Label;
import org.bonorsoft.modules.control.entity.Staff;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.bonorsoft.modules.control.vo.StaffVo;

import java.util.List;

/**
 * @Description: 实有人口从业状况(从业人员信息）
 * @Author: WilliamYe
 * @Date:   2021-03-05
 * @Version: V1.0
 */
public interface StaffMapper extends BaseMapper<Staff> {

    @Select("SELECT id,rkbm,gmsfhm,xm,cyzjdm,zjhm,wwx,wwm,zagldwbm,dwmc,zy,zylbdm,zzbm,zz,lxfs,zdrybz,gjdq,mz,hjdz,ywsfzh,xbdm,csrq,rylb,sfjwry,gw,bq,djdw_gajgjgdm,djdw_gajgmc,djr_xm,djsj,xxdjly_zaglywlbdm,xxdjly_ywlsh,xxzxly_zaglywlbdm,xxzxly_ywlsh,gxsj,sssj,ssfxj,sspcs,sszrq,sjly,zdrylb,hcrybz,zdrylbmc,zxdhzb,zxdzzb,yzj,hlwshr,hlwshsj,ssds,ssjd,sssq,sswg,zxsj,zxr,zxsjbz,zxyy,gxzh,glsyrk,sssqjwwg_dzbm,sssqjcwg_dzbm," +
            "(select photo_path from police_photo where police_photo.id = ybss_ry_syrkcyzk.id) as photo " +
            "FROM ybss_ry_syrkcyzk ${ew.customSqlSegment}")
    IPage<StaffVo> paging(Page<Staff> page, @Param(Constants.WRAPPER) QueryWrapper<Staff> queryWrapper);

    @Select("SELECT id,rkbm,gmsfhm,xm,cyzjdm,zjhm,wwx,wwm,zagldwbm,dwmc,zy,zylbdm,zzbm,zz,lxfs,zdrybz,gjdq,mz,hjdz,ywsfzh,xbdm,csrq,rylb,sfjwry,gw,bq,djdw_gajgjgdm,djdw_gajgmc,djr_xm,djsj,xxdjly_zaglywlbdm,xxdjly_ywlsh,xxzxly_zaglywlbdm,xxzxly_ywlsh,gxsj,sssj,ssfxj,sspcs,sszrq,sjly,zdrylb,hcrybz,zdrylbmc,zxdhzb,zxdzzb,yzj,hlwshr,hlwshsj,ssds,ssjd,sssq,sswg,zxsj,zxr,zxsjbz,zxyy,gxzh,glsyrk,sssqjwwg_dzbm,sssqjcwg_dzbm," +
            "(select photo_path from police_photo where police_photo.id = ybss_ry_syrkcyzk.id) as photo " +
            "FROM ybss_ry_syrkcyzk ${ew.customSqlSegment}")
    List<StaffVo> listing(@Param(Constants.WRAPPER) QueryWrapper<Staff> queryWrapper);

    @Select("select " +
            "l.label_id, l.label_name " +
            "from " +
            "police_label l " +
            "left join ybss_ry_syrkcyzk c " +
            "on c.bq like concat('%',concat(l.label_id,'%')) " +
            "where " +
            "c.id = #{id}")
    List<Label> getLabel(String id);
}
